package com.ruoyi.web.controller.carbon;


import com.ruoyi.carbon.domain.XiaoshouTaizhang;
import com.ruoyi.carbon.service.XiaoshouTaizhangService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/carbon/xiaoshouTaizhang")
@Anonymous
public class XiaoshouTaizhangController extends BaseController {

    @Autowired
    private XiaoshouTaizhangService xiaoshouTaizhangService;


    @GetMapping("/list")
    public TableDataInfo list(XiaoshouTaizhang xiaoshouTaizhang) {
        startPage();
        List<XiaoshouTaizhang> list = xiaoshouTaizhangService.getList(xiaoshouTaizhang);
        return getDataTable(list);
    }

    @PostMapping("/export")
    public void expert(HttpServletResponse response, XiaoshouTaizhang xiaoshouTaizhang) {
        List<XiaoshouTaizhang> list = xiaoshouTaizhangService.getList(xiaoshouTaizhang);
        ExcelUtil<XiaoshouTaizhang> util = new ExcelUtil<>(XiaoshouTaizhang.class);
        util.exportExcel(response, list, "销售台账");
    }
}
